//
//  UIButton+Extension.swift
//  SinaBlog
//
//  Created by ChenWei on 15/11/30.
//  Copyright © 2015年 cw. All rights reserved.
//

import UIKit

extension UIButton {
    /**
    自定义的便利构造器
    
    - parameter title: 标题
    - parameter iamgeName: 图片名称
    
    - returns: 初始化好的UIButton
    */
    /// 自定义的便利构造器 
    convenience init(title: String, iamgeName: String) {
        self.init()
        
        setTitle(title, forState: UIControlState.Normal)
        setImage(UIImage(named: iamgeName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
        
        setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(15)
        titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5)
        imageEdgeInsets = UIEdgeInsets(top: 0, left:0, bottom: 0, right: -5)
        
        adjustsImageWhenHighlighted = false
    }

}
